package com.uenpay.util.net.retrofit;

import com.uenpay.util.net.http.BaseRequest;
import com.uenpay.util.net.listener.HttpOnNextListener;
import com.uenpay.util.net.listener.HttpResultListener;

import java.lang.ref.SoftReference;

import rx.Observable;

/**
 * Created by liulou on 2016/11/15.
 * desc:
 */

public abstract class RetrofitRequest<T> extends BaseRequest {

    private HttpResultListener httpListener;
    private Observable<T> observable;

    //是否对请求进行统一的处理，判断响应的code
    private boolean commomProcess = true;

    public RetrofitRequest(HttpResultListener listener) {
        setHttpListener(listener);
    }

    public RetrofitRequest(HttpResultListener listener, boolean commomProcess) {
        setHttpListener(listener);
        this.commomProcess = commomProcess;
    }

    public HttpResultListener getHttpListener() {
        return httpListener;
    }

    private void setHttpListener(HttpResultListener httpListener) {
        this.httpListener = httpListener;
    }

    /**
     * 设置参数
     *
     * @param methods
     * @return
     */
    public abstract Observable<T> getObservable(Object methods);

    public void setObservable(Observable<T> observable) {
        this.observable = observable;
    }

    public boolean isCommomProcess() {
        return commomProcess;
    }

    public void setCommomProcess(boolean commomProcess) {
        this.commomProcess = commomProcess;
    }
}
